<?php

/**
 * Employee filter form base class.
 *
 * @package    virtualstore
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseEmployeeFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'firstname'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'middlename'        => new sfWidgetFormFilterInput(),
      'lastname'          => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'lastname2'         => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'nationalId'        => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'socialSecurityId'  => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'active'            => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'dateOfBirth'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'gender'            => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'marital_status_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('MaritalStatus'), 'add_empty' => true)),
      'slug'              => new sfWidgetFormFilterInput(),
      'created_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'created_by'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('created_by_fk'), 'add_empty' => true)),
      'updated_by'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('updated_by_fk'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'firstname'         => new sfValidatorPass(array('required' => false)),
      'middlename'        => new sfValidatorPass(array('required' => false)),
      'lastname'          => new sfValidatorPass(array('required' => false)),
      'lastname2'         => new sfValidatorPass(array('required' => false)),
      'nationalId'        => new sfValidatorPass(array('required' => false)),
      'socialSecurityId'  => new sfValidatorPass(array('required' => false)),
      'active'            => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'dateOfBirth'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'gender'            => new sfValidatorPass(array('required' => false)),
      'marital_status_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('MaritalStatus'), 'column' => 'id')),
      'slug'              => new sfValidatorPass(array('required' => false)),
      'created_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'created_by'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('created_by_fk'), 'column' => 'id')),
      'updated_by'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('updated_by_fk'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('employee_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Employee';
  }

  public function getFields()
  {
    return array(
      'id'                => 'Number',
      'firstname'         => 'Text',
      'middlename'        => 'Text',
      'lastname'          => 'Text',
      'lastname2'         => 'Text',
      'nationalId'        => 'Text',
      'socialSecurityId'  => 'Text',
      'active'            => 'Boolean',
      'dateOfBirth'       => 'Date',
      'gender'            => 'Text',
      'marital_status_id' => 'ForeignKey',
      'slug'              => 'Text',
      'created_at'        => 'Date',
      'updated_at'        => 'Date',
      'created_by'        => 'ForeignKey',
      'updated_by'        => 'ForeignKey',
    );
  }
}
